package com.rivulet.doj_backend.tools;

import java.io.Serializable;

/**
 * {封装返回}
 *
 * @author xujiac
 * @create 2021/4/4
 * @since 1.0.0
 */
public class ResultFul<Type> implements Serializable {
    private static final long serialVersionUID = 1L;
    public static final int SUCCESS = 100;

    private String msg="success";
    private Integer code=100;
    private Type data;

    public ResultFul(Integer code,Type data) {
        this.code=code;
        if(!code.equals(SUCCESS)){
            msg ="error";
        }
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
        if(!code.equals(SUCCESS)){
            msg ="error";
        }else {
            msg ="success";
        }
    }

    public Type getData() {
        return data;
    }

    public void setData(Type data) {
        this.data = data;
    }

}
